struct Rect {
    width: i32,
    height: i32,
}

impl Rect {
    fn area(&self) -> i32 {
        self.width * self.height
    }
}

macro_rules! give_me_foo_or_bar {
    (foo) => {};
    (bar) => {};
    ($x:ident) => {
        compile_error!("This macro only accepts `foo` or `bar`");
    }
}

give_me_foo_or_bar!(foo);
// ^ will fail at compile time with message "This macro only accepts `foo` or `bar`"
#[cfg(foo)]
#[cfg(not(any(feature = "foo", feature = "bar")))]
compile_error!("Either feature \"foo\" or \"bar\" must be enabled for this crate.");

fn main() {
    let rect = Rect {
        width: 10,
        height: 20,
    };
    println!(
        "Rect w:{} h:{} area:{}",
        rect.width,
        rect.height,
        rect.area()
    );
}
